import request from "@/utils/request"

// 登录
export const login = ( data ) => {
    return request({
        url: `/web/login`,
        method: 'POST',
        data: data
    })
}


export const tests = () => {
    return request({
        url: `/web/test`,
        method: 'GET'
    })
}


// 登录验证码
export const getVerifyCode = ( username = null ) => {
    return request({
        url: `/verification/verifyCode`,
        method: 'POST',
        params: {
            username: username
        }
    })
}


// 注册 --- user 用户信息
export const register = ( user ) => {
    return request({
        url: `/web/register`,
        method: 'POST',
        data: user
    })
}

export const getUserInfo = (query) => {
    return request({
        url: `/UserManagement/getAllUser`,
        method: 'GET',
        params: query
    })
}



// 获取用户信息
export const getUser =  async( userName ) => {
     const response = await request({
    url: '/user/getUserName',
    method: 'GET',
    params: { userName }
  })
  return response.data
}






// 修改用户信息
export const updateUser = ( user ) => {
    return request({
        url: `/user/updateUserInfo`,
        method: 'POST',
        data: user
    })
}

// 忘记密码
export const ForgotPassword = (data) => {
    return request({
        url: `/user/updatePassword`,
        method: 'PUT',
        data:data
    })
}

// 重置密码
export const resetPassword = (data) => {
    return request({
        url: `/user/resetPassword`,
        method: 'PUT',
        data:data
    })
}